﻿FlyTalk.views.PostView = Ext.extend(Ext.form.FormPanel, {
	
	//layout : 'vbox',
	
	initComponent: function () {
		
		this.backButton = new Ext.Button({
			text: 'Back',
			ui: 'back',
			handler: this.backButtonTap,
			scope: this
		});
	
		this.postToolbar = new Ext.Toolbar({
			title: 'Post',
			items:[
				this.backButton,
				{ xtype: 'spacer' },
			]
		});
		
		
		this.tweetPanel = new Ext.Panel({
			tpl:[ // tempalte for displaying tweets
          		//'<div id="tweet_container">',
                  // '<tpl for=".">',
                        '<div class="tweet_data1" style="margin-top:0px">',
                        	'<div class="tweet_avatar">',
                            	'<img width="30" height="30" src="{profile_image_url}"/>',
                       		'</div>',
                        	'<div class="tweet_content">',
                            	'<a class="user" href="http://twitter.com/{from_user}">{from_user}</a>&nbsp;',
                            	'{text}',
                       	 	'</div>',
                        	'<div class="clear"></div>',
                        '</div>',
                  // '</tpl>',
                //'</div>'
			],
		});
		
		this.msg = new Ext.form.TextArea({
			 name: 'title',
        label: 'Message',
        required: true
		});

		/*
		this.tag = new Ext.form.Select({
			    name: 'tag',
        label: 'Add Tag',
		labelWidth: 100,
		options: [
       		{text: 'my flight',  value: 'first'},
       		{text: 'my airline', value: 'second'},
       		{text: 'my terminal',  value: 'third'},
			{text: 'all airport',  value: 'fourth'}
		]
		});
*/		
        this.dockedItems = [this.postToolbar];
		this.items = [this.tweetPanel, this.msg,];

        FlyTalk.views.PostView.superclass.initComponent.call(this);
    },

    backButtonTap: function () {
        Ext.dispatch({
            controller: FlyTalk.controllers.ftController,
            action: 'toTweetDeck'
        });
    },

});